import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:home_box/pages/medicine/MedicineV/widgets/date_picker.dart';
import 'package:home_box/pages/medicine/MedicineVM/medicine_add_vm.dart';
import 'package:intl/intl.dart';
///药品有效期止
class MedicineExpiryDate extends StatelessWidget {
  const MedicineExpiryDate({super.key});

  @override
  Widget build(BuildContext context) {
    return GetBuilder<MedicineVM>(
      tag: 'MedicineVM',
      builder: (controller) {
        return Container(
          height: 30,
          margin: EdgeInsets.only(top: 10),
          child: Row(
            children: [
              Text('有效期止：', style: TextStyle(fontSize: 14)),
              GestureDetector(
                onTap: () => {datePicker(context, 2, controller)},
                child: Text(
                  DateFormat('yyy-MM-dd').format(
                    controller.medicine.value.expiryData ?? DateTime.now(),
                  ),
                  style: TextStyle(fontSize: 14),
                ),
              ),
            ],
          ),
        );
      },
    );
  }
}
